<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //不传参数，或者明确传递undefined作为参数，只有这个两种情况下吗，默认值才会生效
    const add=(x,y=2)=>x+y
    console.log(add(2,0));
    console.log(add(2));
    console.log(add(2,null));
    console.log(add(2,undefined));
    //默认值是表达式，默认值表达式是惰性赋值
    //函数参数的默认值，最好从参数列表的右边开始设置
    
  </script>
</body>
</html>